package com.jlboot.core.weixin.task;

import com.jlboot.core.ConfigUtil;
import com.jlboot.core.plugins.cron4j.MyCron4jPlugin;
import com.jlboot.model.po.sys.SysTask;
import com.jlboot.core.weixin.util.WxServiceUtil;
import com.jlboot.app.admin.controller.weixin.common.service.MessageActionCache;
import com.jfinal.plugin.cron4j.ITask;
import lombok.extern.slf4j.Slf4j;

/**
 * Created by 51594 on 2023/4/3.
 */
@Slf4j
public class WxServiceTask implements ITask {

    @Override
    public void run() {
        if (ConfigUtil.isLinux()) {
            //发送待发送的微信消息
            SysTask.dao.updateLastAction(MyCron4jPlugin.getPlugin().getTaskId(WxServiceTask.class));
            MessageActionCache.setAction(WxServiceUtil.n().getService());
        }
    }

    @Override
    public void stop() {
        System.out.println("===========发送微信消息任务结束了===============");
    }

}

